package com.rd.student.jike.class1.guojiabao.exam;

import java.io.*;
import java.util.Scanner;

public class FindTeam {
    public static void main(String[] args) throws IOException {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入球员名：");
        String name = scanner.nextLine();

        BufferedReader reader = new BufferedReader(new FileReader("player.txt"));
        String sr;
        boolean exit = false;
        while ((sr = reader.readLine()) != null) {
            String[] arr = sr.split(",");
            if (arr[0].equals(name)) {
                System.out.println("所属球队：" + arr[1]);
                exit = true;
                break;
            }
        }
        if (!exit) {
            System.out.println("不存在该球员。");
        }

    }
}
